﻿using System;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Net;
using CommDll;
using System.Data.SqlClient;
using System.Drawing;

namespace HospitalMedicineTraceability
{
    /// <summary>
    /// ClassName:frmSetup
    /// Version:1.0
    /// Date:2023-04-12
    /// Author:seanouyang
    /// </summary>
    /// <remarks>
    /// 本类是一WinForm 窗体,本窗体主要为系统信息提示
    /// </remarks>
    public partial class frmMessageBox : DevComponents.DotNetBar.OfficeForm
    {
        #region 01.自定义属性
        #endregion

        public frmMessageBox(string strInfo = "")
        {
            InitializeComponent();
            lblInfo.Text = strInfo;
            lblInfo.AutoSize = true;
        }

        protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData) //激活回车键
        {
            int WM_KEYDOWN = 256;
            int WM_SYSKEYDOWN = 260;
            if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
            {
                switch (keyData)
                {
                    case Keys.Escape:
                        btnReturn_Click(null, null);                        
                        break;
                }
            }
            return false;
        }

        #region 03.系统事件方法
        private void frmSetup_Load(object sender, EventArgs e)
        {
            //01 初始化显示
            this.Width = lblInfo.Left + lblInfo.Width + 20;
            btnConfirm.Left = (this.Width - btnConfirm.Width) / 2;
            this.Left = (SystemInformation.PrimaryMonitorSize.Width - this.Width) / 2;
        }

        private void btnReturn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        #endregion
    }
}
